package cn.powernode.service;

import cn.powernode.dao.StudentDao;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service("studentService")
public class StudentService {
    //    @Resource(name = "studentDaoForMySQL")
//    StudentDao studentDao;
//    StudentDao studentDao;

    //不能出现在构造方法上
    /*@Resource(name = "studentDaoForMySQL")
    public StudentService(StudentDao studentDao) {
        this.studentDao = studentDao;
    }*/

    //可以在方法上使用
//    @Resource(name = "studentDaoForMySQL")
//    public void setStudentDao(StudentDao studentDao) {
//        this.studentDao = studentDao;
//    }

    //不设置名字，则优先使用变量的名字(studentDao)为key，在缓存map中查找，自动装配
    //没有找到，则以类型(StudentDao)去自动装配
    @Resource
    StudentDao studentDao;

    public void deletedById(int id) {
        studentDao.deletedById(id);
    }
}
